
**************************************************************
**************************************************************
*
*
*
* 					MICROESTIMATES 
*
*
*
***************************************************************
***************************************************************

use "JEBO_MICRO_DATA.dta"

*************************
* WAVES OF IMMIGRATIONS *
*************************
* Baseline specification
* Grandparents : nativegp (=1 if 4 grandparents are born in the US, =0.75 if 3 out of 4 are born in the US, =0.5 if 2 out of 4, =0.25 if 1 out of 4, = 0 if none are born in the US)
* Parents : nativep (=1 if 2 parents are born in the US, =0.5 if 1 out of 2 is born in the US, =0 if none are born in the US)
* Respondent: native (=1 if born in the US, =0 otherwise) 
* Eth: country of origin of the respondent 

gen gen2=(nativegp==0 & nativep<=0.5 & native==1)  
gen gen3=(nativegp<=0.5 & nativep==1 & native==1 & nativegp!=. & nativep!=.)
gen gen4=(nativegp>0.5 & nativep==1 & native==1 & nativegp!=. & nativep!=.)

gen coh2010=((gen2==1 & (naiss>= 1925 & naiss<1985)) |  (gen3==1 & naiss>= 1950) | (gen4==1 & naiss>= 1975))
gen coh1950=((gen2==1 & naiss<1925) |  (gen3==1 & naiss<1950) | (gen4==1 & naiss<1975))


* GROUP DUMMIES

foreach x in Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp	Swd	Switz	Uk	Youg Jp {
foreach y in coh1950 coh2010 {
quietly gen `x'_`y' = `x'*`y'

}
}

*************************
* TABLE 1 *
*************************
* Reference group: no religion and inactive *

reg trust10_large age men ageedu age2 incomegood catho pro employed unemployed ///
 Afri_coh2010 Afri_coh1950 Aut_coh2010 Aut_coh1950 Bg_coh2010 Bg_coh1950 Cd_coh2010 Cd_coh1950 Czr_coh2010 Czr_coh1950 Dk_coh2010 Dk_coh1950 Fra_coh2010 Fra_coh1950  Fin_coh2010 Fin_coh1950 ///
 Ger_coh2010 Ger_coh1950 Grc_coh1950 Grc_coh2010 Hg_coh2010 Hg_coh1950 India_coh2010 India_coh1950 Ire_coh2010 Ire_coh1950 Ita_coh2010 Ita_coh1950 Mx_coh2010 Mx_coh1950 Nth_coh2010 Nth_coh1950 ///
 Nw_coh2010 Nw_coh1950 Pol_coh2010 Pol_coh1950 Pt_coh2010 Pt_coh1950 Rus_coh2010 Rus_coh1950 Sp_coh2010 Sp_coh1950 Swd_coh2010 Switz_coh2010 Switz_coh1950 Uk_coh2010 Uk_coh1950 ///
 Youg_coh2010 Youg_coh1950 Jp_coh1950 Jp_coh2010 ///
 i.year if (coh2010==1 | coh1950 ==1) , cluster(ethnic)


**************************************************************
*
* SUBSAMPLES 1950 AND 2010
* Coefficients to be used for the Macro part: 
* Split the estimations for 1950 and 2010
* Sweden in 1950 and Sweden in 2010 are the reference country 
*
**************************************************************


*1950
reg trust10_large age men ageedu incomegood catho pro unemployed employed ///
 Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp ///
 i.year if coh1950==1, cluster(ethnic)

estat summarize
est store coh1950

* 2010
reg trust10_large age men ageedu incomegood catho pro unemployed employed ///
 Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp ///
 i.year if coh2010==1, cluster(ethnic)

estat summarize
est store coh2010

est table coh1950 coh2010

* controlling for parents' education 

reg trust10_large age men ageedu preduc incomegood catho pro unemployed employed ///
 Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp ///
 i.year if coh1950==1, cluster(ethnic)

estat summarize
est store coh1950
 

reg trust10_large age men ageedu preduc incomegood catho pro unemployed employed ///
 Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp ///
 i.year if coh2010==1, cluster(ethnic)

estat summarize
est store coh2010

est table coh1950 coh2010
 
*************************
* TABLE 2
*************************
 
* COLUMN 1 
reg trust10_large trust2010_combined age men ageedu incomegood unemployed employed catho pro  /*
*/ if coh2010 ==1 , cluster(ethnic)

* COLUMN 2  
reg trust10_large trust2010_combined age men ageedu incomegood unemployed employed catho pro /*
*/ if coh1950 ==1 , cluster(ethnic)



**************************************************************
*
* SUBSAMPLES 1920 AND 1980 for falsification test
* Coefficients to be used for the Macro part: 
* Split the estimations for 1920 and 1980
* Sweden in 1920 and Sweden in 1980 are the reference country 
*
**************************************************************

gen gen2_test=(nativegp==0 & nativep<=0.5 & native==1)
gen gen3_test=(nativegp<=0.5 & nativep>=0.5 & native==1 & nativegp!=. & nativep!=.)
gen gen4_test=(nativegp>0.5 & nativep>=0.5 & native==1 & nativegp!=. & nativep!=.)

gen coh1980early=((gen2_test==1 & naiss>= 1895 & naiss<1955) |  (gen3_test==1 & naiss>= 1920 & naiss<1980)  | (gen4_test==1 & naiss>= 1945))
gen coh1920early=((gen2_test==1 & naiss<1895) |  (gen3_test==1 & naiss<1920) | (gen4_test==1 & naiss<1945))

* GROUP DUMMIES

foreach x in Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp	Swd	Switz	Uk	Youg Jp {
foreach y in coh1920early coh1980early {
quietly gen `x'_`y' = `x'*`y'

}
}

gen cty_early=1
replace cty_early=0 if (India==1| Bg==1 | Grc==1 | Hg==1 | Pt==1| Youg==1 | Jp==1)

reg trust10_large age men ageedu incomegood /*
*/ Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp /*
*/ i.year if coh1920early ==1 & cty_early==1, cluster(eth)
est store coh1920early


reg trust10_large age men ageedu incomegood /*
*/ Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp /*
*/ i.year if coh1980early ==1 & cty_early==1, cluster(eth)
est store coh1980early

est table coh1920early coh1980early

**************************************************************
*
* SUBSAMPLES 1950 AND 2010 with a 50 year lag for robustness check
* Coefficients to be used for the Macro part: 
* Split the estimations for 1950 and 2010
* Sweden in 1950 and Sweden in 2010 are the reference country 
*
**************************************************************

gen coh2010lag=((gen2_test==1 & (naiss>=1900 & naiss<1960)) |  (gen3_test==1 & naiss>=1925) | (gen4_test==1 & naiss>=1950))
gen coh1950lag=((gen2_test==1 & naiss<1900) |  (gen3_test==1 & naiss<1925) | (gen4_test==1 & naiss<1950))

* GROUP DUMMIES

foreach x in Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp	Swd	Switz	Uk	Youg Jp {
foreach y in coh1950lag coh2010lag {
quietly gen `x'_`y' = `x'*`y'

}
}

gen cty_lag=1
replace cty_lag=0 if (Pt==1 | Youg==1 | Jp==1)

reg trust10_large age men ageedu incomegood /*
*/  Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Rus Sp  Switz /*
*/ i.year if cty_lag==1 & coh1950lag==1, cluster(eth)
est store coh1950lag

reg trust10_large age men ageedu incomegood /*
*/  Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Rus Sp  Switz /*
*/ i.year if cty_lag==1 & coh2010lag==1, cluster(eth)
est store coh2010lag

est table coh1950lag coh2010lag


* controlling for parents' education 

reg trust10_large age men ageedu preduc incomegood ///
 Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp ///
 i.year if cty_lag==1 & coh1950lag==1, cluster(eth)

estat summarize
est store coh1950


reg trust10_large age men ageedu preduc incomegood ///
 Afri Aut Bg Uk Cd Czr Dk Fin Fra Ger Grc Hg India Ire Ita Mx Nth Nw Pol Pt Rus Sp  Switz Youg Jp ///
 i.year if cty_lag==1 & coh2010lag==1, cluster(eth)

estat summarize
est store coh2010

est table coh1950 coh2010

**************************************************************
*
* SUBSAMPLES 1970 AND 2010 for robustness check
* Coefficients to be used for the Macro part: 
* Split the estimations for 1970 and 2010
* Sweden in 1970 and Sweden in 2010 are the reference country 
*
**************************************************************


gen coh2010shortlag=((gen2_test==1 & (naiss>= 1920 & naiss<1960)) |  (gen3_test==1 & naiss>= 1945)  | (gen4_test==1 & naiss>= 1970))
gen coh1970shortlag=((gen2_test==1 & naiss<1920) |  (gen3_test==1 & naiss<1945) | (gen4_test==1 & naiss<1970))


foreach x in Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp	Swd	Switz	Uk	Youg Jp {
foreach y in coh1970shortlag coh2010shortlag {
quietly gen `x'_`y' = `x'*`y'

}
}

reg trust10_large age men ageedu incomegood /*
*/  Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp Switz	Uk	Youg Jp /*
*/ i.year if coh1970shortlag==1, cluster(eth)
est store coh1970shortlag

reg trust10_large age men ageedu incomegood /*
*/  Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp Switz	Uk	Youg Jp /*
*/ i.year if coh2010shortlag==1, cluster(eth)
est store coh2010shortlag

est table coh1970shortlag coh2010shortlag

* controlling for parents' education 

reg trust10_large age men ageedu incomegood preduc /*
*/  Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp Switz	Uk	Youg Jp /*
*/ i.year if coh1970shortlag==1, cluster(eth)
est store coh1970shortlagP

reg trust10_large age men ageedu incomegood preduc /*
*/  Afri Aut Bg Cd	Czr	Dk	Fin	Fra	Ger	Grc	Hg	India	Ire	Ita	Mx	Nth	Nw	Pol	Pt	Rus	Sp Switz	Uk	Youg Jp /*
*/ i.year if coh2010shortlag==1, cluster(eth)
est store coh2010shortlagP

est table coh1970shortlagP coh2010shortlagP
